package cn.wx.read.neo4j.repository;

import java.util.List;

import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;

import cn.wx.read.neo4j.entity.Neo4jPatents;

public interface Neo4jPatentsRepository extends Neo4jRepository<Neo4jPatents,Long>{
	
	/**
	 * 批量插入专家
	 * @param rows
	 * @return
	 */
	@Query("UNWIND {rows} as row merge(n:patents{fId:row.fId}) set "
			+ " n.fId = row.fId, "
			+ " n.year = row.year, "
			+ " n.year = row.cit, "
			+ " n.year = row.fPublishDate "
			+ " return ID(n) as id")
	List<Long> saveBetch(@Param("rows") List<Neo4jPatents> rows);
}
